package org.example.domain.po;


import lombok.Data;
import lombok.EqualsAndHashCode;
import org.example.domain.enums.MessageTypeEnum;

/**
 * @description:
 * @author: feixiang.li
 * @date: 2025-01-02 20:33
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class RpcRequestMessagePO extends MessagePO {

    /**
     * 调用的接口全限定名，服务端根据它找到实现
     */
    private String interfaceName;
    /**
     * 调用接口中的方法名
     */
    private String methodName;
    /**
     * 方法返回类型
     */
    private Class<?> returnType;
    /**
     * 方法参数类型数组
     */
    private Class<?>[] parameterTypes;
    /**
     * 方法参数值数组
     */
    private Object[] parameterValue;


    public RpcRequestMessagePO(int sequenceId, String interfaceName, String methodName, Class<?> returnType, Class<?>[] parameterTypes, Object[] parameterValue) {
        super.setSequenceId(sequenceId);
        this.interfaceName = interfaceName;
        this.methodName = methodName;
        this.returnType = returnType;
        this.parameterTypes = parameterTypes;
        this.parameterValue = parameterValue;
    }

    @Override
    public int getMessageType() {
        return MessageTypeEnum.RPC_REQUEST.getValue();
    }
}
